var e = getApp();

Page({
    data: {
        language: "",
        selected: 0,
        page: 1
    },
    onLoad: function(e) {
        this.getData(this.data.selected);
    },
    swichTabTItem: function(e) {
        this.setData({
            selected: e.detail.index,
            page: 1
        }), this.getData(this.data.selected);
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        console.log(this.data.current_page), console.log(this.data.last_page), this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), this.getNext(this.data.selected)) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    getNext: function(a) {
        var t = this, n = "";
        "0" == a ? n = "plugin.pending-order.frontend.goods-queue.index" : "1" == a ? n = "plugin.pending-order.frontend.goods-queue.wait-queue" : "2" == a && (n = "plugin.pending-order.frontend.goods-queue.success-queue");
        var o = e.getNetAddresss(n);
        e._getNetWork({
            url: o,
            data: {
                page: t.data.page
            },
            success: function(e) {
                var a = e.data;
                if (1 == a.result) {
                    if (console.log(a), a.data.current_page > a.data.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void t.setData({
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                    wx.hideLoading(), t.setData({
                        info: t.data.info.concat(a.data.data),
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                } else console.log("请求失败");
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    onShareAppMessage: function() {},
    getData: function(a) {
        var t = this, n = "";
        "0" == a ? n = "plugin.pending-order.frontend.goods-queue.index" : "1" == a ? n = "plugin.pending-order.frontend.goods-queue.wait-queue" : "2" == a && (n = "plugin.pending-order.frontend.goods-queue.success-queue");
        var o = e.getNetAddresss(n);
        e._getNetWork({
            url: o,
            data: {
                page: this.data.page
            },
            success: function(e) {
                var a = e.data;
                1 == a.result ? (console.log(a), t.setData({
                    info: a.data.data,
                    current_page: a.data.current_page,
                    last_page: a.data.last_page
                })) : console.log("请求失败");
            },
            fail: function(e) {
                console.log(e);
            }
        });
    }
});